package com.zygh.policeasset.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zygh.policeasset.mapper.AccountsMapper;
import com.zygh.policeasset.pojo.Accounts;
import com.zygh.policeasset.pojo.Completed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AccountsService {

    @Autowired
    AccountsMapper accountsMapper;

    public int add(Accounts accounts){
        return  accountsMapper.add(accounts);
    }
    public PageInfo findAll(Accounts accounts,int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<Accounts> list = accountsMapper.findAll(accounts);
        PageInfo<Accounts> pageInfo = new PageInfo<>(list);
        return pageInfo;

    }
    public Accounts selectById(Integer id){
        return  accountsMapper.selectById(id);
    }

    public int update(Accounts accounts){
        return  accountsMapper.update(accounts);
    }

    public int delete(Integer id){
        return accountsMapper.delete(id);
    }

}
